package com.example.mobile2121606109ycg0611homework;

import android.os.Bundle;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    private WebView wvMainNotice;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();

        wvMainNotice.loadUrl("file:////android_asset/index.html");
        wvMainNotice.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request){
                view.loadUrl(request.getUrl().toString());
                return true;
            }
        });
        wvMainNotice.getSettings().setJavaScriptEnabled(true);
    }

    private void initView() {
        wvMainNotice = (WebView) findViewById(R.id.wvMainNotice);
    }
}